package org.example.coffeeshoporderingsystem.common.service.impl;


import org.example.coffeeshoporderingsystem.common.dao.BaseDAO;
import org.example.coffeeshoporderingsystem.common.enitty.BaseEntity;
import org.springframework.beans.factory.annotation.Autowired;


import java.util.List;

public abstract class BaseServiceImpl<T extends BaseEntity,D extends BaseDAO<T>> {
    @Autowired
    protected D baseDAO ;


    public List<T> findAll() {
            return baseDAO.selectAll();
        }


        public boolean save(T entity) {
            return baseDAO.insert(entity);
        }


        public boolean remove(Integer id) {
            return baseDAO.delete(id);
        }


        public T findById(Integer id) {
            return baseDAO.selectById(id);
        }


        public boolean modify(T entity) {
            return baseDAO.update(entity);
        }
    }
